import React, { Component } from 'react'
import store from '../../store'
import {
  add,
  asyncRide,
  minus,
  getMenuListData
} from '../../store/actionCreator'

export default class CompA extends Component {
  //   add = () => {
  //     store.dispatch({
  //       type: 'ADD',
  //       payload: 5
  //     })
  //   }
  //   minus = () => {
  //     store.dispatch({
  //       type: 'MINUS',
  //       payload: 10
  //     })
  //   }

  render () {
    return (
      <div>
        <p>ComA</p>
        <p>count---{store.getState().counter}</p>
        <p>
          <button onClick={() => store.dispatch(add(5))}>点击数量+</button>
          &nbsp;&nbsp;
          <button onClick={() => store.dispatch(minus(10))}>点击数量-</button>
          <button onClick={() => store.dispatch(asyncRide(2))}>
            点击数量×
          </button>
          <button onClick={() => store.dispatch(getMenuListData())}>
            点击获取菜单
          </button>
        </p>
      </div>
    )
  }
}
